package com.facebookproject;

import java.util.ArrayList;
import java.util.List;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import com.facebookproject.getsuggestitems.Item;
import com.facebookproject.getsuggestitems.ItemAdapter;
import com.facebookproject.graph.GraphSearchActivity;

public class FragmentLocation extends ListFragment{

	ItemAdapter adapter;
	List<Item> myListItems = new ArrayList<Item>();
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
		
		
		
		adapter = new ItemAdapter(getActivity(), R.layout.item, myListItems);
		setListAdapter(adapter);

		return inflater.inflate(R.layout.fragment_location, null);
	}
	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		myListItems.clear();
		myListItems.add(new Item("loc_restaurant", "Restaurants"));		
		myListItems.add(new Item("loc_coffee", "Coffee"));				
		myListItems.add(new Item("loc_cinema", "Cinema"));
		super.onActivityCreated(savedInstanceState);
	}
	@Override
	public void onListItemClick(ListView l, View v, int position, long id) {
		position+=1;
		Intent intent = new Intent(getActivity(), GraphSearchActivity.class);
		intent.putExtra("type", position);
		intent.putExtra("tab", 3);
		startActivity(intent);
		super.onListItemClick(l, v, position, id);
	}
}